def is_prime(n):
    for i in range(2, int(n**0.5)+1):
        if n%i==0:
            return False
    return True
assert is_prime(97)==True
assert is_prime(100)==False
assert is_prime(101)==True
digits={
    'zero':'0',
    'one':'1',
    'two':'2',
    'three':'3',
    'four':'4',
}
s=input()
lst=s.split()
number=''
for v in lst:
    if v in digits:
        number+=digits[v]
    else:
        print("NO")
        exit()
number=int(number)
print(number)
for n in range(number, number+246):
    if is_prime(n):
        print(number, n)
        max=n
        break

for n in range(2, number):
        if is_prime(n):
            min=n
                
if number-min > max-number:
    print("ближайшее",max)
else:
    print("ближайшее",min)  
